home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Tools / TASM V5 / ALIASWIN.PAK / NEWUSER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-21  |  2.6 KB  |  103 lines

  1. /*
  2.    newuser.c
  3.  
  4.    Copyright (c) 1993 by Borland International, Inc.
  5.  
  6.    This module links with library.lib using names with underscores.
  7.  
  8.    Part of the aliaswin example.
  9.  
  10.    Build using the provided makefile using:
  11.      "make -B" or "make -B -DWIN16".
  12.       
  13. */
  14.  
  15. #define  STRICT
  16. #include <windows.h>
  17.  
  18. /* Prototypes for functions in library.lib. These prototypes are different
  19.    from the ones in the library and they will be resolved through aliasing. */
  20.  
  21. extern void Set_Coords( LPARAM lParam );
  22. extern void Draw_Happy_Face( HDC hdc );
  23. extern void Print_Message( HDC hdc, PSTR WhoIsIt );
  24.  
  25. char szAppName[] = "New User Program";
  26.  
  27. LRESULT FAR PASCAL WndProc( HWND hWnd, UINT iMessage, WPARAM wParam,
  28.                             LPARAM lParam )
  29. {
  30.     HDC hdc;
  31.     PAINTSTRUCT ps;
  32.  
  33.     switch (iMessage)
  34.     {
  35.          case WM_SIZE:
  36.             Set_Coords( lParam );              /* Call into library.lib */
  37.             return 0;
  38.  
  39.          case WM_PAINT:
  40.             hdc = BeginPaint( hWnd, &ps );
  41.  
  42.             Draw_Happy_Face( hdc );            /* Call into library.lib */
  43.             Print_Message( hdc, "New User" );  /* Call into library.lib */
  44.  
  45.             EndPaint( hWnd, &ps );
  46.             return 0;
  47.  
  48.          case WM_DESTROY:
  49.             PostQuitMessage( 0 );
  50.             return 0;
  51.     }
  52.     return DefWindowProc( hWnd, iMessage, wParam, lParam );
  53. }
  54.  
  55. #pragma option -w-
  56.  
  57. int PASCAL WinMain( HINSTANCE hInstance,
  58.                     HINSTANCE hPrevInstance,
  59.                     LPSTR lpszCmdLine,
  60.                     int nCmdShow )
  61. {
  62.    WNDCLASS wndclass;
  63.    MSG msg;
  64.    HWND hWnd;
  65.  
  66.    if ( ! hPrevInstance ) {
  67.  
  68.         wndclass.style         = CS_HREDRAW | CS_VREDRAW;
  69.         wndclass.lpfnWndProc   = WndProc;
  70.         wndclass.cbClsExtra    = 0;
  71.         wndclass.cbWndExtra    = 0;
  72.         wndclass.hInstance     = hInstance;
  73.         wndclass.hIcon         = LoadIcon( NULL, IDI_APPLICATION );
  74.         wndclass.hCursor       = LoadCursor( NULL, IDC_ARROW );
  75.         wndclass.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
  76.         wndclass.lpszMenuName  = NULL;
  77.         wndclass.lpszClassName = szAppName;
  78.  
  79.         RegisterClass( &wndclass );
  80.    }
  81.    hWnd = CreateWindow( szAppName,
  82.        "New User",
  83.        WS_OVERLAPPEDWINDOW,
  84.        CW_USEDEFAULT,
  85.        CW_USEDEFAULT,
  86.        CW_USEDEFAULT,
  87.        CW_USEDEFAULT,
  88.        NULL,
  89.        NULL,
  90.        hInstance,
  91.        NULL );
  92.  
  93.    ShowWindow( hWnd, nCmdShow );
  94.    UpdateWindow( hWnd );
  95.  
  96.    while( GetMessage( &msg, NULL, 0, 0 ) )
  97.    {
  98.        TranslateMessage( &msg );
  99.        DispatchMessage( &msg );
  100.    }
  101.    return msg.wParam;
  102. }
  103.